package com.jmu.content.controller.user;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jmu.content.pojo.PriceList;
import com.jmu.content.result.Result;
import com.jmu.content.service.PriceListService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author fems
 * @since 2024-05-06
 */
@RestController("userPriceListController")
@RequestMapping("/user/price-list")
public class PriceListController {

    @Autowired
    PriceListService priceListService;

    @GetMapping("/{id}")
    @ApiOperation("查询充电站的价目信息")
    public Result<List> getByStationId(@PathVariable Long id){
        LambdaQueryWrapper<PriceList> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(PriceList::getStationId,id);
        queryWrapper.orderByAsc(PriceList::getBeginTime);

        List<PriceList> list = priceListService.list(queryWrapper);
        return Result.success(list);
    }

}
